package com.seeyon.apps.kk.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.seeyon.apps.kk.manager.FormDataBaseManager;
import com.seeyon.ctp.common.controller.BaseController;

public class QiangsBaseController extends BaseController {
	
	private FormDataBaseManager kkBaseFormManager;
	
	public void setKkBaseFormManager(FormDataBaseManager kkBaseFormManager) {
		this.kkBaseFormManager = kkBaseFormManager;
	}

	public ModelAndView treePlug(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView mav = new ModelAndView("apps/qiangs/tree");
		String selects = request.getParameter("selects") == null 
					? "" : request.getParameter("selects").toString();
		String enumName = request.getParameter("enumName").toString();
		int showLevel = Integer.valueOf(request.getParameter("showLevel").toString()).intValue();
		List<Map> mapList = kkBaseFormManager.getTreeDate(enumName, selects, showLevel);
		request.setAttribute("fftree", mapList );
		mav.addObject("isTop", showLevel);
		return mav;
	}
	
}
